package com.yanqu.road.server.cmd.activity.dragonboatrace;

import com.yanqu.road.pb.dragonboatrace.DragonBoatRaceProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.activity.dragonboatrace.DragonBoatRaceMgr;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.CrossProtocol;

/**
 * @Description
 * @Author cwq
 * @Data 2022/2/15 17:06
 */
@Cmd(code = CrossProtocol.C2_DRAGONBOATRACE_ENTER_MAP, desc = "赛龙舟 进入地图")
public class CrossDragonBoatRaceEnterMapCmd extends CrossCommand {

    int activityId ;
    long userId ;
    String unionId;
    int placeId;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        DragonBoatRaceProto.DragonBoatRaceEnterMapGameToCrossMsg builder = DragonBoatRaceProto.DragonBoatRaceEnterMapGameToCrossMsg.parseFrom(packet.getBytes());
        activityId = builder.getActivityId();
        userId = packet.getPlayerId();
        unionId = builder.getUnionId();
        placeId = builder.getPlaceId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        MessageHelper.sendPacket(serverId, userId, YanQuMessageUtils.buildMessage(ClientProtocol.U_DRAGONBOATRACE_ENTER_MAP, DragonBoatRaceMgr.enterMap(activityId,unionId,placeId)));
    }

    @Override
    public void sendData() {

    }
}
